package com.wn.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.wn.pojo.Subject;
import com.wn.mapper.SubjectMapper;
import com.wn.service.ISubjectService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 课程科目 服务实现类
 * </p>
 *
 * @author yellow docker
 * @since 2023-06-20
 */
@Service
public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> implements ISubjectService {

    @Override
    public List<Subject> findSubjectByParentId(String parentId) {

        //lambda mp的条件查询
        LambdaQueryWrapper<Subject> subjectLambdaQueryWrapper = Wrappers.lambdaQuery(Subject.class);

        //eq 是 =
        subjectLambdaQueryWrapper.eq(Subject::getParentId, parentId);
        List<Subject> list = list(subjectLambdaQueryWrapper);

        return list;
    }
}
